package cn.donting.jme.expansion.attribute;


import lombok.Getter;
import lombok.Setter;

import java.awt.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public abstract class AttributeGroup {
    @Getter
    @Setter
    private String key;
    private List<Attribute> attributes = new ArrayList<>();

    public void addAttribute(Attribute attribute) {
        attributes.add(attribute);
    }

    public void addAttribute(Collection<Attribute> attributes) {
        for (Attribute attribute : attributes) {
            addAttribute(attribute);
        }
    }

    public void clear() {
        attributes.clear();
    }

    public List<Attribute> getAttributes() {
        return List.of(attributes.toArray(new Attribute[attributes.size()]));
    }

    public abstract Container getUiContainer();

}
